package com.wanhu.player
{
	import com.adobe.serialization.json.*;
	import com.wanhu.player.Supervisor;
	import com.wanhu.player.Reader;
	
	import flash.events.*;
	import flash.events.Event;
	import flash.net.*;
	import flash.utils.*;

	public class Reception extends Object
	{
		public static var PING:String="ping";
		public static var REMOVE:String="remove";
		public static var LOOKUP:String="lookup";
		public static var CUT:String = "cut";

		public static var scanUrl:String="/upload/api/{0}.php";

		public static function post(action:String, f:Function):void
		{
			var reader:Reader=null;
			var urlVariables:*=new URLVariables();

			urlVariables.action=action;
			urlVariables.nearID=Supervisor.nearID;
			urlVariables.status=Supervisor.callStatus;
			urlVariables.userType=Supervisor.userType;
			urlVariables.region_id=Supervisor.region_id;
			urlVariables.boradcastStatus=Supervisor.boradcastStatus;

			reader=new Reader(getUrl(action), urlVariables, f, {action: action});
		}

		private static function getUrl(action:String):String
		{
			return scanUrl.replace("{0}", action);
		}
	}
}
